package com.cda.service.impl;

import com.cda.entity.MonneyInfoLog;
import com.cda.service.MonneyInfoLogService;
import org.springframework.stereotype.Service;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by peiming on 2019/3/6.
 */
@Service("monneyInfoLogService")
public class MonneyInfoLogServiceImpl implements MonneyInfoLogService {

        public static void main(String[] args) throws Exception {
            MonneyInfoLog monneyInfoLog = new MonneyInfoLog();
            monneyInfoLog.setAmount("3333");
            List<MonneyInfoLog> monneyInfoLogList=new ArrayList<MonneyInfoLog>();
            monneyInfoLogList.add(monneyInfoLog);
            monneyInfoLog=new MonneyInfoLog();
            monneyInfoLog.setAmount("222");
            monneyInfoLogList.add(monneyInfoLog);
            FileOutputStream fos=new FileOutputStream("F:"+ File.separator+"TestF1iles"+File.separator+"M1yTest.txt");
            ObjectOutputStream oos = new ObjectOutputStream(fos);
            oos.writeObject(monneyInfoLogList);
            System.out.println(monneyInfoLogList);
            oos.close();

            FileInputStream fis = new FileInputStream("F:"+File.separator+"TestFiles"+File.separator+"MyTest.txt");
            ObjectInputStream ois = new ObjectInputStream(fis);
            List<MonneyInfoLog> student2= ( List<MonneyInfoLog>) ois.readObject();
            System.out.println(student2);

        }


}
